<docs>
  ## select 组件    编辑页面专属
</docs>
<template>
<div @change="$emit('selectValue', selectValue)"
  :class="`weui-cell weui-cell_select weui-cell_select-after
 ${valid === status.REJECTED ? 'weui-cell_warn' : ''}`">
  <div class="weui-cell__hd">
    <label class="weui-label">{{label}}</label>
  </div>
  <div class="weui-cell__bd">
    <select class="weui-select" v-model="selectValue"
      @focus="resetValid">
      <option value = "01">常用岗位</option>
      <option value = "02">全部岗位</option>
    </select>
  </div>
</div>
</template>
<script>
import { mixinValid } from 'common/mixins/mixins';

export default {
  name: 'edit-select',
  props: {
    label: String,
    prop: String,
    value: String,
    xsqb: String,
    rules: Object,
  },
  data() {
    return {
      selectValue: ''
    };
  },
  created(){
    if (this.xsqb == '1') {
      this.selectValue = "02";
    } else {
      this.selectValue = "01";
    }
  },
  watch: {
    selectValue(val) {
      this.$emit('input', val);
      this.$nextTick(() => {
        this.validItem();
      });
    },
  },
  mixins: [mixinValid]
};
</script>
<style scoped lang="scss">
@import '~common/scss/var.scss';
.weui-label {
  @include label;
}
.weui-select {
  @include input-text;
}
</style>
